package com.woniuxy.third.controller;

import com.woniuxy.third.annotations.RequirePermission;
import com.woniuxy.third.enyity.Goods;
import com.woniuxy.third.result.ResponseResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RestController
@RequestMapping("/goods")
public class GoodsController {

    @RequirePermission("goods:all")
    @RequestMapping("/all")
    public ResponseResult<List<Goods>> all(){
        List<Goods> goods = Arrays.asList(
                new Goods(1001,"电脑"),
                new Goods(1002,"电脑1"),
                new Goods(1003,"电脑2")
        );
        ResponseResult<List<Goods>> result = new ResponseResult<>();
        result.setCode(200);
        result.setMessage("success");
        result.setData(goods);
        return result;
    }
}
